import request from "@/utils/request";
import { getCompanyCode } from "../utils/token";

// 获取首页列表
export function queryHomePageRichTextList(params) {
  return request({
    url: "/h5/nvr/queryHomePageRichTextList",
    method: "get",
    params: {
      ...params,
      companyCode: getCompanyCode(),
    },
  });
}
// 获取首页轮播图
export function queryHomePageCarouselImageList(params) {
  return request({
    url: "/h5/nvr/queryHomePageCarouselImageList",
    method: "get",
    params: {
      ...params,
      companyCode: getCompanyCode(),
    },
  });
}
// 获取动态列表
export function queryNewsFeedRichTextList(params) {
  return request({
    url: "/h5/nvr/queryNewsFeedRichTextList",
    method: "get",
    params: {
      ...params,
      companyCode: getCompanyCode(),
    },
  });
}
// 获取服务页轮播图
export function queryServiceCarouselImageList(params) {
  return request({
    url: "/h5/nvr/queryServiceCarouselImageList",
    method: "get",
    params: {
      ...params,
      companyCode: getCompanyCode(),
    },
  });
}
// 获取服务列表
export function queryServiceQuestionnaireList(params) {
  return request({
    url: "/h5/nvr/queryServiceQuestionnaireList",
    method: "get",
    params: {
      ...params,
      companyCode: getCompanyCode(),
    },
  });
}
// 获取公司信息

export function queryCompanyInfo(params) {
  return request({
    url: "/h5/nvr/queryCompanyInfo",
    method: "get",
    params: {
      ...params,
      companyCode: getCompanyCode(),
    },
  });
}
// 获取富文本详情
export function queryRichTextDetails(id) {
  return request({
    url: "/h5/nvr/queryRichTextDetails?id=" + id,
    method: "get",
  });
}
// 获取问卷详情
export function queryQuestionnaireDetails(id) {
  return request({
    url: "/h5/nvr/queryQuestionnaireDetails?id=" + id,
    method: "get",
  });
}
// 提交问卷
export function submitQuestionnaire(data) {
  return request({
    url: "/h5/submitQuestionnaire",
    method: "post",
    data,
  });
}

// 提交问卷列表
export function queryUserQuestionnaireList(params) {
  return request({
    url: "/h5/queryUserQuestionnaireList",
    method: "get",
    params,
  });
}
// 获取提交问卷详情
export function queryQuestionnaireSubmissionRecordDetails(id) {
  return request({
    url: "/h5/queryQuestionnaireSubmissionRecordDetails?id=" + id,
    method: "get",
  });
}
// 表单提交列表
export function queryUserFromQuestionnaireList(params) {
  return request({
    url: "/h5/queryUserFromQuestionnaireList",
    method: "get",
    params,
  });
}
// 发送验证码
export function sendSmsCode(tel) {
  return request({
    url: "/h5/nvr/sendSmsCode?phone="+tel,
    method: "post",
  });
}
// 用户登录
export function userLogin(data) {
  return request({
    url: "/h5/nvr/login",
    method: "post",
    data:{
      ...data,
      companyCode:getCompanyCode()
    }
  });
}
// 获取用户信息
export function queryUserInfo() {
  return request({
    url: "/h5/queryUserInfo",
    method: "get",
  });
}
// 文件上传
export function uploadFile(data) {
  return request({
    url: "/common/upload",
    method: "post",
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}
// 修改用户信息
export function updateUserInfo(data) {
  return request({
    url: "/h5/updateUserInfo",
    method: "post",
    data,
  });
}